<?php

/**
 * Acao form base class.
 *
 * @package    form
 * @subpackage acao
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseAcaoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'cd_acao'             => new sfWidgetFormInputHidden(),
      'cd_proposicao'       => new sfWidgetFormDoctrineChoice(array('model' => 'Proposicao', 'add_empty' => false)),
      'name'                => new sfWidgetFormInput(),
      'de_acao'             => new sfWidgetFormTextarea(),
      'dt_limite_conclusao' => new sfWidgetFormDate(),
      'dt_conclusao'        => new sfWidgetFormDateTime(),
      'deleted'             => new sfWidgetFormInputCheckbox(),
      'created_at'          => new sfWidgetFormDateTime(),
      'updated_at'          => new sfWidgetFormDateTime(),
      'slug'                => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'cd_acao'             => new sfValidatorDoctrineChoice(array('model' => 'Acao', 'column' => 'cd_acao', 'required' => false)),
      'cd_proposicao'       => new sfValidatorDoctrineChoice(array('model' => 'Proposicao')),
      'name'                => new sfValidatorString(array('max_length' => 255)),
      'de_acao'             => new sfValidatorString(array('max_length' => 4000)),
      'dt_limite_conclusao' => new sfValidatorDate(),
      'dt_conclusao'        => new sfValidatorDateTime(array('required' => false)),
      'deleted'             => new sfValidatorBoolean(),
      'created_at'          => new sfValidatorDateTime(array('required' => false)),
      'updated_at'          => new sfValidatorDateTime(array('required' => false)),
      'slug'                => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorDoctrineUnique(array('model' => 'Acao', 'column' => array('slug')))
    );

    $this->widgetSchema->setNameFormat('acao[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Acao';
  }

}
